#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
using namespace std;
bool isLetter(char ch)
{
    if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool isPalindrome(string s) {
    if (s == " ")
    {
        return true;
    }
    for (auto& e : s)
    {
        if (e >= 'A' && e <= 'Z')
        {
            e += 32;
        }
    }
    int start = 0, end = s.size() - 1;
    while (start < end)
    {
        while (start < end && !isLetter(s[start]))
        {
            start++;
        }
        while (start < end && !isLetter(s[end]))
        {
            end--;
        }
        if (s[start] == s[end])
        {
            start++;
            end--;
        }
        else
        {
            return false;
        }
    }
    return true;
}


int main()
{
    string s("0p");
    cout << isPalindrome(s) << endl;
    return 0;
}